import os
from utils import ReadXml


SrcDir = r"/media/fang/TOSHIBA EXT/Temp/Circle/Small/0110_road"

DeleteLabelNames = ['RemoveLimit']
AlreadyDelete = []

for root, dirs, files in os.walk(SrcDir):
    for file in files:
        if file[-1] == 'l':
            Infos = ReadXml(root + "/" + file)
            for Info in Infos:
                if Info[-1] in DeleteLabelNames:
                    AlreadyDelete.append(file)
                    os.remove(root + "/" + file)
                    os.remove(root + "/" + file[:-3] + "jpg")
                    break

print("Total delete %d group(xml、jpg) files" % len(AlreadyDelete))
print(AlreadyDelete)
